<template>
  <a-card :loading="loading" :body-style="{padding: '16px'}" :bordered="false">
   <a-row>
      <a-col class="chart-card-left" :xs="18" :sm="4" :md="4" :lg="4" :xl="6" :xxl="8" :style="{backgroundColor: backgroundColor + ''}">
        <slot name="icon"></slot>
      </a-col>
      <a-col :xs="18" :sm="18" :md="18" :lg="18" :xl="18" :xxl="16" style="float: right;top: 12px;left: 4px;">
        <div class="chart-card">
          <div class="meta">
            <span class="chart-card-title">{{title}}</span>
            <span class="chart-card-action">
              <slot name="action"></slot>
            </span>
          </div>
          <div class="total"><span>{{total}}</span></div>
        </div>
      </a-col>
    </a-row>
  </a-card>
</template>

<script>
export default {
  name: 'ChartCard',
  props: ['title', 'total', 'loading', 'backgroundColor']
}
</script>

<style scoped lang="less">
  .chart-card-left {
    height: 90px;
    width: 90px;
    border-radius: 5px;
    text-align: center;
    font-size: 24px;
    line-height: 88px;
    color: #FFFFFF;
  }
  .chart-card{
    position: relative;
    overflow: hidden;
    width: 100%;
  }
  /deep/.ant-card-body:hover {
    cursor: pointer;
    background-color: @primary-2;
  }
  .chart-card .meta{
    position: relative;
    overflow: hidden;
    width: 100%;
    color: #595959;
    font-size: 17px;
    line-height: 22px;
  }
  .chart-card-action{
    cursor: pointer;
    position: absolute;
    top: 0;
    right: 0;
  }
  .total {
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-all;
    white-space: nowrap;
    margin-top: 4px;
    margin-bottom: 0;
    font-size: 40px;
    line-height: 40px;
    height: 38px;
    color: #595959;
  }
</style>